﻿package com.sun.blog.sunblog.base;

import java.util.LinkedHashMap;
import java.util.Map;

public enum MyConstants{
    USER_ADMIN("管理员"),USER_GUEST("游客"),
    BLOGTYPE_ORIGINAL("原创"),BLOGTYPE_REPRINT("转帖"),
    BLOG_PUBLISHED("已发布"),BLOG_DRAFT("草稿")
    ;
    
    private String value;
    private MyConstants(String value){
        this.value = value;
    }

    public String getValue(){
        return value;
    }

    public static String getValueByName(String name){
        for(MyConstants e : MyConstants.values()){
            if(e.name().equals(name)){
                return e.getValue();
            }
        }
        return "Undefined";
    }

    public static Map<String, String> getUserTypes(){
        Map<String, String> map = new LinkedHashMap<String, String>();
        map.put("USER_GUEST", USER_GUEST.getValue());
        map.put("USER_ADMIN", USER_ADMIN.getValue());
        return map;
    }

    public static void main(String[] args){
        System.out.println(MyConstants.USER_GUEST.getValue());
    }
}